//
//  ViewController.m
//  循环滚动视图
//
//  Created by dllo on 16/6/13.
//  Copyright © 2016年 zuzhiming. All rights reserved.
//

#import "ViewController.h"
#import "CustomScrollView.h"
@interface ViewController ()
@property (nonatomic, retain) CustomScrollView *customScrollView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    //加载自定义滚动视图
    [self createCustomScrollView];
    
    //加载数据
    [self DataHandle];
    
}

//创建自定义滚动视图
- (void)createCustomScrollView
{
    self.customScrollView = [[CustomScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 240)];
    
    [self.view addSubview:_customScrollView];
    [_customScrollView release];
}

//准备数据
- (void)DataHandle
{
    NSMutableArray *dataArray = [NSMutableArray array];
    for (NSInteger i = 1; i <= 6; i++) {
        NSString *imagePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%ld", i] ofType:@"jpg"];
        UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
        [dataArray addObject:image];
    }
    self.customScrollView.imageArray = dataArray;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
